Hello all, |
Re: trigger new object creation |
Re: trigger new object creation Create triggers work only on discussions and comments. Use a sync trigger similar to:
trigger("New Object Trigger", module->object, post, sync, 10, "print identifier(current Object) \"\\n\"")
|
Re: trigger new object creation I am not aware of a way to trigger on object creation. If you look at the "Trigger overview" table in the DXL help you will find that the only triggers for objects are open/sync, which will trigger on locking an object and changing the current object. Not sure, what you are trying to do, but if you find a solution for that a lot of people will be very interested. Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: trigger new object creation johnzweck - Wed May 12 11:25:10 EDT 2010 Create triggers work only on discussions and comments. Use a sync trigger similar to:
trigger("New Object Trigger", module->object, post, sync, 10, "print identifier(current Object) \"\\n\"")
> put a check in your DXL file to see if it's a new Object. I had though that this maybe the way to go, any insight on the best way to identify if an object is new? |
Re: trigger new object creation johnzweck - Wed May 12 11:25:10 EDT 2010 Create triggers work only on discussions and comments. Use a sync trigger similar to:
trigger("New Object Trigger", module->object, post, sync, 10, "print identifier(current Object) \"\\n\"")
This is what i came up with...
Trigger T = current Trigger
Object o = object T
Date cr = o."Created On"
int curTime = intOf(dateAndTime(today)) //current time in seconds
int creTime = intOf(dateAndTime(cr)) //object creation time in seconds
creTime = creTime + 1 //increase object creation time by 1 sec
//if object was created in the last sec then...
if(curTime < creTime) then {
/****** whatever code you want ******/
}
|
Re: trigger new object creation johnzweck - Wed May 12 11:25:10 EDT 2010 Create triggers work only on discussions and comments. Use a sync trigger similar to:
trigger("New Object Trigger", module->object, post, sync, 10, "print identifier(current Object) \"\\n\"")
a) Objects that are created by a DXL script will not fire the trigger (current object does not change) b) The trigger might fire twice or more on a script action c) Copying objects will not fire the trigger (current object does not change) d) Creating Tables will fire the trigger only for the first cell e) That check if the object was created at this second can get problematic! You will get glitches (second increased before trigger was executed). For all these reasons and probably some more I would recommend not to use a sync trigger as a replace for one of the missing triggers (link creation, object creation, deletions, etc.) The sync trigger is just to unreliable ... You should think about if you can achieve the goal you have (whatever that is) by some other means ... Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: trigger new object creation This is over my head, but perhaps we can modify the 'create' object functions by inserting our own in the user's Top context. Such code would look something like this:
Object createOriginal(Object obj)
{ return(create(obj)) // issue call to the original create
} // end createOriginal()
Object create(Object obj)
{ // Enhanced, replaces original create
Object oCreated = createOriginal(obj)
if (null oCreated) return(oCreated)
// now deal with the newly created object 'oCreated' as you see fit
return(oCreated)
} // end enhanced create(Object)
|
Re: trigger new object creation llandale - Thu May 13 15:22:04 EDT 2010 This is over my head, but perhaps we can modify the 'create' object functions by inserting our own in the user's Top context. Such code would look something like this:
Object createOriginal(Object obj)
{ return(create(obj)) // issue call to the original create
} // end createOriginal()
Object create(Object obj)
{ // Enhanced, replaces original create
Object oCreated = createOriginal(obj)
if (null oCreated) return(oCreated)
// now deal with the newly created object 'oCreated' as you see fit
return(oCreated)
} // end enhanced create(Object)
What works decently is a "pre save" trigger on the module, that will scan for objects that have been created in this session (check the DOORS history!) and perform some action, maybe combined with the sync trigger that will fire only unreliably and remember the user to do stuff. I find that people want to implement those "object creation" triggers because they want to fill out an attribute, present a dialog box to "force" the user to do something or some other reason. In 95% of the cases there is probably a more DOORS like way to do the same thing, but iannacones did not tell us what the reason for the object creation trigger is, so I cannot help with this one. Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: trigger new object creation Mathias Mamsch - Thu May 13 15:52:37 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS Hello, Mathias. I've tried using the module close trigger as a way to check if newly created objects were created using the traditional methods (Ctrl-N, Ctrl-L, Insert->Object->Below, etc) or through our CPS Insert Pending Change function. It somewhat worked, but was not optimal in that it would cause several objects to be "burned" if the creation was done outside of the CPS controls. I was hoping for the object pre create trigger capability to implemented. If there is no plan to implement this trigger event for objects, then I could try investigating other possibilities, or go back to the module close trigger function. Thank you for all that you and others have done to keep these forums running and available. Kind regards, John |